Skip to content

Conversation

@nitely
Copy link
Contributor

@nitely nitely commented Jan 12, 2026

Followup #136

Changes:

  • loggerSetup to onLoaded
  • The onLoaded takes a config var parameter

@nitely nitely enabled auto-merge (squash) January 12, 2026 17:44
@nitely nitely disabled auto-merge January 12, 2026 17:44
@nitely nitely enabled auto-merge (squash) January 12, 2026 17:54
@nitely nitely merged commit f684e55 into status-im:master Jan 12, 2026
24 checks passed
@nitely nitely deleted the fix_136_followup_obsolete branch January 12, 2026 18:11
@arnetheduck
Copy link
Member

Come to think of it, an alternative way to implement this is via compile-time lookup, ie a mixin-based approach where users can provide onLoaded with a higher generic matching specificity, similar to how serialization finds readValue.

Not sure if it's worth the bother, but it's maybe more in line with the confutils architecture overall (same as with overloading parseCmdArg)

@nitely
Copy link
Contributor Author

nitely commented Jan 13, 2026 via email

@nitely
Copy link
Contributor Author

nitely commented Jan 13, 2026

In nimbus you would overload onLoaded(conf: var object)

mmh, I think nimbus could just expose a setup logger overload generator:

template setupLogger*(ConfType: type): untyped =
  proc onLoaded(conf: var ConfType) =
    # ... setup logger

then do setupLogger(MyConf) everywhere where MyConf is loaded.

or more generally:

template setupConf*(ConfType: type, setupLogger: bool): untyped =
  proc onLoaded(conf: var ConfType) =
    when setupLogger:
      # ... setup logger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants